'use strict';

module.exports = function collectSameElements(collectionA, objectB) {
  let result=[];
  let newa=[];
  let newb=[];
  for(let value of collectionA){
    newa.push(value.key);
  }
  for(let value of objectB.value){
    newb.push(value);
  }
  for(let i=0;i<newa.length;i++){
    for(let n=0;n<newb.length;n++){
      if(newa[i]==newb[n]){
        result.push(newa[i]);
      }
    }
 } 
  return result;
}
